/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package tletlis.model;

import java.awt.Color;
import java.util.ArrayList;
import java.util.List;


/**
 * The Turquoise brick shaped like an I.
 * @author Gustav
 */
public class TurquoiseBrick extends AbstractBrick {

    //Boolean to keep track of rotation state
    private boolean vertical = true;

 /**
  * Constructor for initializing the shape of the brick
  * and the starting state.
  * @param y The vertical position were the brick will start.
  * @param x The horizontal position were the brick will start.
  */
    public TurquoiseBrick(int y, int x) {
        cords = new ArrayList<Position>();
        distance = Position.getLength();
        for(int i = 0; i < 4; i++) {
            cords.add(new Position(y,x+(i*distance)));
        }
        color = new Color(9,205,218);
    }

  /**
   * Method returning the rotated shape of the brick.
   * @return List<Position>
   */
    @Override
    protected List<Position> rotateBrick() {
        List<Position> temp = new ArrayList<Position>();
        for(Position p: cords) {
            temp.add(new Position(p.getY(),p.getX()));
        }
        if(vertical) {
            temp.set(0, new Position(cords.get(2).getY(),cords.get(2).getX()-2*Position.getLength()));
            temp.set(1, new Position(cords.get(2).getY(),cords.get(2).getX()-Position.getLength()));
            temp.set(3, new Position(cords.get(2).getY(),cords.get(2).getX()+Position.getLength()));
            
            
        }
        else {
            temp.set(0, new Position(cords.get(2).getY()-2*Position.getLength(),cords.get(2).getX()));
            temp.set(1, new Position(cords.get(2).getY()-Position.getLength(),cords.get(2).getX()));
            temp.set(3, new Position(cords.get(2).getY()+Position.getLength(),cords.get(2).getX()));
            
            
        }
        return temp;
    }
    @Override
    protected void nextState() {
        vertical = !vertical;
    }

}
